<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>DPlayer</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css">
    <link rel="stylesheet" href="demo.css">
    <script src="https://cdn.jsdelivr.net/npm/flv.js/dist/flv.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/hls.js/dist/hls.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/dashjs/dist/dash.all.min.js"></script>
    <script src="https://cdn.jsdelivr.net/webtorrent/latest/webtorrent.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/pearplayer"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
    <!-- source -->
    <script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
    <!-- bootstrap -->
    <!-- <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script> -->
    <style type="text/css">
        body {
            background-color: #000;
        }
        
    </style>
</head>

<body class="markdown-body">
    <div class="example">
        <div id="dplayer"></div>
        <br>
        <div class="btns" align="center">
            <input type="number" name="number" min="1" max="400" />
            <button class="btn" onclick="switchVideo()">Switch Video</button>
        </div>
    </div>
    <script type="text/javascript">
        
        const dp = new DPlayer({
            container: document.getElementById('dplayer'),
            autoplay: true,
            volume: 0.4,
            video: {
                url: 'http://gaogaogaogaogaogao.zs520ds.cn/gaotian/video.php',
            },
        });

        randomNum();
        function randomNum() {
            $(" input[ name='number' ] ").val(getRndInteger(1, 329));
        }

        function getRndInteger(min, max) {
          return Math.floor(Math.random() * (max - min + 1) ) + min;
        }

        function switchVideo() {
            var num = $(" input[ name='number' ] ").val();
            var mp = num + ".mp4";
            console.log(mp);
            mp = 'http://gaogaogaogaogaogao.zs520ds.cn/gaotian/video.php';
            dp.switchVideo(
                {
                    url: mp,
                }
            );
            dp.play();
            randomNum();
        }

    </script>
    <!-- <script src="https://cdn.jsdelivr.net/npm/stats.js"></script>
    <script src="demo.js"></script> -->
</body>

</html>